        <!--Body content-->
        <div id="content" class="clearfix">
            <div class="contentwrapper"><!--Content wrapper-->
                <div class="heading">
                    <h3>Tambah Bahan</h3>                    
                    <div class="resBtnSearch">
                        <a href="#"><span class="icon16 icomoon-icon-search-3"></span></a>
                    </div>

                <!--    <div class="search">

                        <form id="searchform" action="http://themes.suggeelson.com/supr/search.html">
                            <input type="text" id="tipue_search_input" class="top-search" placeholder="Search here ..." />
                            <input type="submit" id="tipue_search_button" class="search-btn" value=""/>
                        </form>
                
                    </div>
                    
                    <ul class="breadcrumb">
                        <li>You are here:</li>
                        <li>
                            <a href="#" class="tip" title="back to dashboard">
                                <span class="icon16 icomoon-icon-screen-2"></span>
                            </a> 
                            <span class="divider">
                                <span class="icon16 icomoon-icon-arrow-right-2"></span>
                            </span>
                        </li>
                        <li class="active">Forms</li>
                    </ul><!-- End search -->

                </div><!-- End .heading-->
    				
                <!-- Build page from here: Usual with <div class="row-fluid"></div> -->

                    <div class="row-fluid">

                        <div class="span6">

                            <div class="box">

                                <div class="title">

                                    <h4> 
                                        <span>Kolom Tambah Bahan</span>
                                    </h4>
                                    
                                </div>
                                <div class="content">
                                    <form class="form-horizontal" id="form-bahan_masuk" action="" method="POST" onReset="resetForm()">
<input name="id" id="id" type="hidden"/>
<input name="tanggal" id="tanggal" type="hidden" value="<?php echo date("Y-m-d H:i:s");?>"/>
                                        <div class="form-row row-fluid"> 
                                            <div class="span12">
                                                <div class="row-fluid">
												<?php 
												$arrNamaBahan = array();
												foreach ($nama_bahan_gudang as $row){
												$arrNamaBahan[] = $row->nama_bahan;
												}
												?>
                                                    <label class="form-label span4" for="placeholder">Nama Bahan</label>
                                                    <input class="span8" id="nama_bahan" name="nama_bahan" type="text" placeholder="Nama Bahan"  />
													
                                                </div>
                                            </div> 
                                        </div>
                                        <div class="form-row row-fluid"> 
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4" for="placeholder">Jumlah</label>
                                                    <input class="span8" id="jumlah" name="jumlah" type="text" placeholder="Jumlah" value="<?php //echo $data['jumlah']?>" />
                                                </div>
                                            </div> 
                                        </div>

										<div class="form-actions">
<button type="submit" id="save" name="save" class="btn btn-info" style="display:none">Simpan</button>
<button type="submit" class="btn btn-info" id="add" name="add">Simpan</button>
<button type="submit" id="delete" name="delete" class="btn btn-danger" style="display:none" onclick="return confirm('Apakah anda yakin ingin menghapus data ini?')">Hapus</button>
                                           <button type="reset" id="clear" name="Clear" class="btn">Bersihkan</button>
                                        </div>
                                    </form>
                                </div>
                            </div><!-- End .box -->

                        </div><!-- End .span6 -->    
<div class="span6">
                            
                            <div class="box">

                                <div class="title">

                                    <h4>
<!--                                        <span class="icon16 icomoon-icon-equalizer-2"></span> -->
                                        <span>Daftar Bahan Masuk</span>
                                    </h4>
                                    <a href="#" class="minimize">Minimize</a>
                                </div>
                                <div class="content noPad clearfix">
                                    <table cellpadding="0" cellspacing="0" border="0" class="responsive bahan_masukTable display table table-bordered" width="100%">
                                        <thead>
                                          <tr>
                                            <th>#</th>
                                            <th>Bahan</th>
                                            <th>Jumlah</th>
                                            <th>Hapus</th>
                                          </tr>
                                        </thead>
                                        <tbody>
									<?php $no=1;foreach($temp as $row){?>
										  <tr id="row_<?php echo $row->id_bahan;?>">
                                            <td><?php echo $no++;?></td>
                                            <td><?php echo $row->nama_bahan;?></td>
                                            <td class="center"><?php echo $row->jumlah;?></td>
											<td>
												<div class="controls center">
													<a href="<?php echo base_url()."bahan/delete/".$row->id_bahan;?>" title="Remove task" class="tip"><span class="icon12 icon-trash"></span></a>
												</div>
											</td>
                                          </tr>
										  <?php }?>

                                        </tbody>
                                    </table>
                                </div>
				<div class="form-actions">
				<a href="<?php echo site_url('bahan/report');?>" onClick="reload()" class="btn btn-info pull-right" id="selesai" name="selesai" target="_blank">Selesai</a>
				</div>
                            </div><!-- End .box -->

                        </div><!-- End .span6 -->						
                    </div><!-- End .row-fluid -->
            </div><!-- End contentwrapper -->
        </div><!-- End #content -->
<script type="text/javascript">
function resetForm() {
	$('#save').attr("style","display:none");
	$('#delete').attr("style","display:none");
	$('#add').removeAttr("style");
	$('#nama_bahan').removeAttr('readonly');
	console.log("remove");
}
function reload(){
	document.location.href = sites + "bahan";
}
</script>
<script type="text/javascript">
	// validasi form-bahan_masuk
    $(function() { 	
            $("#form-bahan_masuk").validate({
                rules: {
                    nama_bahan: {
                        required: true,
						remote: {
							url: "<?php echo base_url();?>bahan/cek_not_name",
							type: "post"
						}
                    },
					jumlah: {
						required: true,
						digits: true
					}
                }   
            });
		});
		
		$('.bahan_masukTable tbody tr').live('click', function () {
        var sTitle;
        var nTds = $('td', this);
		var nTrs = $(nTds).parents('tr').attr('id');
		var id = nTrs.replace("row_","");
		$('#id').val(id);			
		var nama = $(nTds[1]).text();
        var jumlah = $(nTds[2]).text();
		$('#nama_bahan').val(nama);	
		$('#jumlah').val(jumlah);
		$('#nama_bahan').attr('readonly','readonly');	
		$('#add').attr("style","display:none");
		$('#save').removeAttr("style");
		$('#delete').removeAttr("style");
		} );
    //--------------- Data tables ------------------//

	if($('table').hasClass('bahan_masukTable')){
		$('.bahan_masukTable').dataTable({
			"bJQueryUI": false,
			"bFilter": false,
			"bAutoWidth": false,
			"iDisplayLength": 5,
			"bLengthChange": false,
			"aoColumnDefs": [{ 
				"bSortable": false, "aTargets": [ 0, 1, 2, 3 ] 
			}],
		});
	}
// document ready function
//$(document).ready(function() { 
//------------- JQuery Autocomplete -------------//
    $(function() {
		var arrNamaBahan = <?php echo json_encode($arrNamaBahan); ?>;
		$( "#nama_bahan" ).autocomplete({
			source: function( request, response ) {
			  var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
			  response( $.grep( arrNamaBahan, function( item ){
				  return matcher.test( item );
			  }) );
			}
		});
	});
//});
</script>	
<!--
<script type="text/javascript" src="<?php echo base_url();?>assets/js/widgets.js"></script><!-- Init plugins only for page -->